home *** CD-ROM | disk | FTP | other *** search
/ LiquidLibrary 2005 September / LiquidLibrary 2005 Sep - Disc 1.iso / pc / Portfolio Browser / Filters / PDF / pstotxt3.dll / RCDATA / 3 < prev   
Text File  |  2003-01-03  |  3KB  |  85 lines

  1. % Copyright (C) 1995, Digital Equipment Corporation.
  2. % All rights reserved.
  3. % See the file pstotext.txt for a full description.
  4. %
  5. % Lectern:
  6. %   PostScript to be prepended to a job to rotate its images by //angle,
  7. %   adjusting the page shape appropriately.  This works only for
  8. %   devices (such as ppmraw) that allow arbitrary imaging areas.
  9.  
  10. % Last modified on Thu Aug  1 11:36:25 PDT 1996 by mcjones
  11. %      modified on Tue Mar 14 14:55:13 PST 1995 by birrell
  12.  
  13. 4 dict begin
  14. /myDict currentdict def
  15. /angle 90 def
  16.  
  17. /languagelevel where { pop languagelevel 2 ge } { FALSE } ifelse 
  18.   {
  19.   % Use setpagedevice for level 2 implementations
  20.   /lastW 0 def
  21.   /lastH 0 def
  22.   <<
  23.     /BeginPage {
  24.       //myDict begin
  25.       pop % page number
  26.       currentpagedevice /PageSize get aload pop % stack: W H
  27. %      (H = ) print dup =
  28. %      (W = ) print 1 index = flush
  29. %      (lastH = ) print lastH =
  30. %      (lastW = ) print lastW = flush
  31.       lastH ne exch lastW ne or {
  32.         % /PageSize has changed: rotate it
  33.         <<
  34.           /PageSize [
  35.             currentpagedevice /PageSize get aload pop % stack: W H
  36.             exch % stack: newW newH
  37.             /lastW 2 index def
  38.             /lastH 1 index def
  39.             ]
  40.           >> setpagedevice % calls BeginPage recursively
  41. %        (H := ) print lastH =
  42. %        (W := ) print lastW = flush
  43.         } {
  44.         % Rotate ctm.  Don't do this if we're also adjusting PageSize,
  45.         % because that causes another BeginPage call, which does this.
  46.         currentpagedevice /PageSize get aload pop % stack: width height
  47.         2 div exch 2 div exch % stack: center
  48.         2 copy translate //angle rotate neg exch neg translate
  49.         } ifelse
  50.       end % //myDict
  51.       }
  52.     >> setpagedevice
  53.   } {
  54.   % Use ghostscript specific code for earlier systems
  55.   % flip current frame buffer
  56.     currentdevice getdeviceprops >> /HWSize get
  57.     aload pop exch 2 array astore
  58.     mark exch /HWSize exch currentdevice putdeviceprops pop
  59.   % fix showpage to add a rotation and translation
  60.     /adbFixup {
  61.         currentdevice getdeviceprops >>
  62.         dup /HWSize get aload pop 3 -1 roll
  63.         /HWResolution get aload pop
  64.         % stack: xsize ysize xres yres
  65.         exch 4 -1 roll exch div 72 mul
  66.         % stack: ysize yres xpts
  67.         3 1 roll div 72 mul
  68.         % stack: xpts ypts
  69.         2 div exch 2 div exch
  70.         2 copy translate //angle rotate neg exch neg translate
  71.         } bind odef
  72.     /adbShowpage /showpage load def
  73.     userdict begin /showpage { adbShowpage adbFixup } bind odef end
  74.     adbFixup
  75.   % define new ".setpagesize" that flips its arguments
  76.     statusdict begin
  77.         /adbSet /.setpagesize load def
  78.         /.setpagesize {
  79.           exch adbSet adbFixup
  80.           } bind def
  81.         end
  82.   } ifelse
  83.  
  84. end % //myDict